﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Hourglass.Qrobot.Models
{
    public class ReturnedFriendInfo
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        [JsonProperty("uin")]
        public long Uin { get; set; }

        #region 昵称、个人说明

        /// <summary>
        /// 昵称
        /// </summary>
        [JsonProperty("nick")]
        public string NickName { get; set; }

        /// <summary>
        /// 个人说明
        /// </summary>
        [JsonProperty("personal")]
        public string Personal { get; set; }

        #endregion 昵称、个人说明

        #region 个人栏：性别、生日、生肖、星座、血型

        /// <summary>
        /// 性别[male/female]
        /// </summary>
        [JsonProperty("gender")]
        public string Gender { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        [JsonProperty("birthday")]
        public UserBirthday Birthday { get; set; }

        /// <summary>
        /// 生肖
        /// </summary>
        [DefaultValue(0)]
        [JsonProperty("shengxiao")]
        public int Shengxiao { get; set; }

        /// <summary>
        /// 星座
        /// </summary>
        [DefaultValue(0)]
        [JsonProperty("constel")]
        public int Constel { get; set; }

        /// <summary>
        /// 血型
        /// </summary>
        [DefaultValue(0)]
        [JsonProperty("blood")]
        public int Blood { get; set; }

        #endregion 个人栏：性别、生日、生肖、星座、血型

        #region 所在地

        /// <summary>
        /// 国家
        /// </summary>
        [JsonProperty("country")]
        public string Country { get; set; }

        /// <summary>
        /// 省份
        /// </summary>
        [JsonProperty("province")]
        public string Province { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        [JsonProperty("city")]
        public string City { get; set; }

        #endregion 所在地

        #region 联系方式：电话、手机、主页、邮箱、地址、邮编

        /// <summary>
        /// 电话
        /// </summary>
        [JsonProperty("phone")]
        public string Phone { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [JsonProperty("mobile")]
        public string Mobile { get; set; }

        /// <summary>
        /// 主页
        /// </summary>
        [JsonProperty("homepage")]
        public string Homepage { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [JsonProperty("email")]
        public string Email { get; set; }

        #endregion 联系方式：电话、手机、主页、邮箱、地址、邮编

        #region 个人信息

        /// <summary>
        /// 职业/学历
        /// </summary>
        [JsonProperty("occupation")]
        public string Occupation { get; set; }

        /// <summary>
        /// 大学
        /// </summary>
        [JsonProperty("college")]
        public string College { get; set; }

        #endregion 个人信息

        [JsonProperty("face")]
        public int Face { get; set; }

        [JsonProperty("allow")]
        public int Allow { get; set; }

        #region Internal Class

        public sealed class UserBirthday
        {
            [JsonProperty("month")]
            public int Month { get; set; }

            [JsonProperty("year")]
            public int Year { get; set; }

            [JsonProperty("day")]
            public int Day { get; set; }

            /// <summary>
            /// 是否未设置生日
            /// </summary>
            /// <returns></returns>
            public bool IsNotSet()
            {
                return Year == 0 || Month == 0 || Day == 0;
            }

            /// <summary>
            /// 转换为DateTime
            /// </summary>
            /// <returns></returns>
            public DateTime? ToDateTime()
            {
                return IsNotSet() ? (DateTime?)null : new DateTime(Year, Month, Day);
            }
        }

        #endregion Internal Class
    }
}
